command.cgi

Last update: April 2015

command.cgi allows external devices such as smartphones and PCs to get and edit information in the FlashAir via Wireless LAN.

command.cgi uses the CGI (Common Gateway Interface) system, so that external devices may execute the command while connected to the FlashAir by sending an HTTP GET request to: http://flashair/command.cgi?<parameter>

The following is a list of operations available using command.cgi:

Function Parameter Example Firmware Version
Get file list op=100&DIR=/DCIM 1.00.00+
Get the number of files op=101&DIR=/DCIM 1.00.00+
Get update status op=102 1.00.00+
Get SSID op=104 1.00.00+
Get network password op=105 1.00.00+
Get MAC address op=106 1.00.00+
Get browser language op=107 1.00.00+
Get the firmware version op=108 1.00.00+
Get the control image op=109 2.00.00+
Get Wireless LAN mode op=110 2.00.00+
Get Wireless LAN timeout length op=111 2.00.00+
Get application unique information op=117 2.00.00+
Get Upload parameters op=118 2.00.02+
Get CID op=120 1.00.03+
Get time stamp of write event op=121 2.00.02+
Get data from shared memory op=130&ADDR=0&LEN=8 2.00.00+
Set data to shared memory op=131&ADDR=0&LEN=8&DATA=0123ABCD 2.00.00+
Get the number of empty sectors op=140 1.00.03+
Control SD Interface as user I/O op=190&CTRL=0x1f&DATA=0x1f 2.00.03+
Enable Photo Share mode op=200&DIR=/DCIM/100__TSB&DATE=17153 2.00.00+
Disable Photo Share mode op=201 2.00.00+
Get Photo Share mode status op=202 2.00.00+
Get SSID for Photo Share mode op=203 2.00.00+
Get FlashAir Drive(WebDAV) information op=220 3.00.00+
Get timezone op=221 3.00.00+

Get file list

(op=100)

Returns a list of files in a specified directory.

Parameter:

DIR

Path to the directory

Request example:

http://flashair/command.cgi?op=100&DIR=/DCIM

Each row of the list is returned in the following format.

<directory>, <filename>, <size>, <attribute>, <date>, <time>

Response example:

WLANSD_FILELIST
/DCIM,100__TSB,0,16,9944,129
/DCIM,0126_1.jpg,70408,32,17071,28040

Please remind that file names may contain commas ( ,) if you parse a response.
If DIR=/ (root) is specified, directory name will be empty.

<directory>
File directory name
<filename>
File name
<size>
The size of the file in bytes (decimal form)
<attribute>
The attributes of the file (decimal form)
<date>
The date of the file (decimal form)
<time>
The time of the file (decimal form)

Attribute is specified in decimal 16-bit integer in the following formats:

Bit 5
Archive
Bit 4
Directly
Bit 3
Volume
Bit 2
System file
Bit 1
Hidden file
Bit 0
Read only

Date is specified in decimal 16-bit integer in the following formats:

Bit 15-9
Year: Specify a value based on 0 as a 1980.
Bit 8-5
Month: Specify a value from 1 to 12.
Bit 4-0
Day: Specify a value from 1 to 31.

Time is specified in decimal 16-bit integer in the following formats:

Bit 15-11
Hour
Bit 10-5
Minute
Bit 4-0
Second / 2

This operation is available in Firmware Versions 1.00.00+

Get the number of files

(op=101)

Returns the number of files in a specified directory.

Request Example:

http://flashair/command.cgi?op=101&DIR=/DCIM

Response Example:

2

This operation is available in Firmware Versions 1.00.00+

Get update status

(op=102)

Returns whether the FlashAir memory has been updated. Returns 1 if memory has been updated, 0 if not. Once this command is called, the status will be cleared.

Request Example:

http://flashair/command.cgi?op=102

Response Example:

1

This operation is available in Firmware Versions 1.00.00+

Get SSID

(op=104)

Returns the SSID of the FlashAir (32 character maximum)

Request Example:

http://flashair/command.cgi?op=104

Response Example:

flashair_e8e0b756a7fb

This operation is available in Firmware Versions 1.00.00+

Get network password

(op=105)

Returns the network key (63 character maximum) when the FlashAir is in AP mode. If the network key was set on an SD host device such as a cooperative digital camera, this command will not display the network password.

Request Example:

http://flashair/command.cgi?op=105

Response Example:

12345678

This operation is available in Firmware Versions 1.00.00+

Get MAC address

(op=106)

Returns the MAC address of the client that issued the request.

Request Example:

http://flashair/command.cgi?op=106

Response Example:

a41731f4d880

This operation is available in Firmware Versions 1.00.00+

Get acceptable browser language

(op=107)

Returns the Accept-Language parameter from your browser language settings.

Request Example:

http://flashair/command.cgi?op=107

Response Example:

Accept-Language: ja,en-US;q=0.8,en;q=0.6

This operation is available in Firmware Versions 1.00.00+

Get the firmware version

(op=108)

Returns the firmware version of the FlashAir card. Versions that start with F24 are type 1.00 for the W-01 card. Versions that start with F19 are type 2.00 for the W-02 card.

Request Example:

http://flashair/command.cgi?op=108

Response Example:

F19BAW3AW2.00.00

This operation is available in Firmware Versions 1.00.00+

Get the control image

(op=109)

Get the full-path of the image to use as the wireless boot screen. The wireless boot screen is an image file that controls whether the Wireless LAN is ON or OFF when the Wireless LAN mode (APPMODE) is 0, 2, or 3.

To learn more about CIPATH, refer to the article regarding CIPATH in the CONFIG section.

Request Example:

http://flashair/command.cgi?op=109

Response Example:

/DCIM/100__TSB/FA000001.JPG

This operation is available in Firmware Versions 2.00.00+

Get Wireless LAN mode

(op=110)

Returns the current Wireless LAN mode (APPMODE). To learn more about APPMODE, refer to the article regarding APPMODE in the CONFIG section.

Request Example:

http://flashair/command.cgi?op=110

Response Example:

4

This operation is available in Firmware Versions 2.00.00+

Get the Wireless LAN timeout period

(op=111)

Returns the automatic time-out period (in milliseconds) after which the FlashAir will stop its Wireless LAN functionality if it is not being connected to. Available only when Wireless LAN mode is in Auto boot AP mode. To learn more about APPAUTOTIME, refer to the article regarding APPAUTOTIME in the CONFIG section.

Request Example:

http://flashair/command.cgi?op=111

Response Example:

300000

This operation is available in Firmware Versions 2.00.00+

Get application specific information

(op=117)

Get 16 characters uniquely used by the application. To learn more about APPINFO, refer to the article regarding APPINFO in the CONFIG section.

Request Example:

http://flashair/command.cgi?op=117

Response Example:

0123ABCD4567EFGH

This operation is available in Firmware Versions 2.00.00+

Get Upload parameters

(op=118)

Get the parameters currently set for Uploading. To learn more about UPLOAD, refer to the article regarding UPLOAD in the CONFIG section.

1 Uploading is enabled.
Other Uploading is disabled.

Request Example:

http://flashair/command.cgi?op=118

Response Example:

1

This operation is available in Firmware Versions 2.00.02+

Get card identifier

(op=120)

Returns the CID designated by the SD specification. The CID is consists of 32 hexadecimal digits that are unique to each SD card.

Request Example:

http://flashair/command.cgi?op=120

Response Example:

02544d535730384708c00b78700d201

This operation is available in Firmware Versions 1.00.03+

Get time stamp of write event

(op=121)

Returns the internal time stamp of when a write event occurred. A Write event occurs, for example, when you Drag & Drop a file onto the FlashAir using Windows Explore. The time stamp indicates the number of milliseconds since the card has been running.

Request Example:

http://flashair/command.cgi?op=121

Response Example:

174428

This operation is available in Firmware Versions 2.00.02+

Read data from shared memory

(op=130)

Gets data from shared memory. It uses CMD48: Read Extension Register Single Block Command, a command specified by the SD standard.

Returns SUCCESS if the command succeeded. If not, it returns 400 Bad Request.

Request Example:

http://flashair/command.cgi?op=130&ADDR=0&LEN=8

ADDR
Address. 0-511 or 0x0-0x1FF.
LEN
Length. 0-512 or 0x0-0x200.

Response Example:

0123ABCD

This operation is available in Firmware Versions 2.00.00+

Write data to shared memory

(op=131)

Writes data to shared memory. It uses CMD49: Write Extension Register Single Block Command, a command specified by the SD standard.

Returns SUCCESS if the command succeeded. If not, it returns 400 Bad Request.

Request Example:

http://flashair/command.cgi?op=131&ADDR=0&LEN=8&DATA=0123ABCD

ADDR
Address. 0-511 or 0x0-0x1FF.
LEN
Length. 0-512 or 0x0-0x200.
DATA
Data to be written. The length of the data must be equal to LEN.

This operation is available in Firmware Versions 2.00.00+

Get the number of empty sectors

(op=140)

Returns the number of empty sectors in the FlashAir in the format: Number of empty sectors/Total number of sectors, Sector size (Byte)

Request Example:

http://flashair/command.cgi?op=140

Response Example:

13952920/15228928,512

This example shows that of the card's 15228928 sector capacity, 13952920 sectors are unused. At 512 bytes per sector, this means that 6.7GB of the total 7.26GB (8GB card) remains empty.

This operation is available in Firmware Versions 1.00.03+

Control SD Interface as user I/O

(op=190)

Control the I/O pins of the SD Interface as User I/O.

Prerequisites for using this feature is as follows:

  • CONFIG file specifies IFMODE=1.
  • Host device does not perform SD Initialization.

To learn more about IFMODE, refer to the article regarding IFMODE in the CONFIG section.

Request Example:

http://flashair/command.cgi?op=190&CTRL=01f&DATA=0x1f

CTRL
Input or output.
Set 0 for the bits you want to read from, and Set 1 for the bits you want to write to.
DATA
Sets the output.
Set 0 to output low, or set 1 to output high.

Bit mappings

  • CMD : 0x01
  • D0 : 0x02
  • D1 : 0x04
  • D2 : 0x08
  • D3 : 0x10

Response Example:

{"STATUS":"OK","CTRL":"0x1f","DATA":"0x1f"}

This operation is available in Firmware Versions 2.00.03+

Enable Photo Share mode

(op=200)

Enables Photo Share mode. Photo Share mode is used to limit access to data other than in the specified directory or from the specified date.
When Photo Share mode is enabled, HTTP GET requests to directories specified by command.cgi are ignored and instead data from the directory and date specified by Photo Share mode are returned.

Returns OK if command succeeded. If not, it returns 400 Bad Request

Request Example:

http://flashair/command.cgi?op=200&DIR=/DCIM/100__TSB&DATE=17153

For detail regarding parameters, refer to Get file list.

This operation is available in Firmware Versions 2.00.00+

Notice:

If you use op=200 to enable photo sharing mode, the SSID and network security key will not be changed from the already set contents.

To change the network security key, change the network security key using network security key setting in config.cgi.

To change the SSID, please change the SSID by using SSID setting in config.cgi.

Disable Photo Share mode

(op=201)

Disables Photo Share mode. Photo Share mode is used to limit access to data other than that in the specified directory or of the specified date.

Returns OK if command succeeded. If not, it returns 400 Bad Request

Request Example:

http://flashair/command.cgi?op=201

This operation is available in Firmware Versions 2.00.00+

Get Photo Share mode status

(op=202)

Returns whether Photo Share mode is enabled or not.

If Photo Share mode is enabled, it returns SHAREMODE. If Photo Share mode is disabled, it returns NORMALMODE.

Request Example:

http://flashair/command.cgi?op=202

Response Example:

SHAREMODE

This operation is available in Firmware Versions 2.00.00+

Get SSID for Photo Share mode

(op=203)

Returns a special SSID used for Photo Share mode.

Request Example:

http://flashair/command.cgi?op=203

Response Example:

photoshare_e8e0b756a7fb

This operation is available in Firmware Versions 2.00.00+

Get FlashAir Drive(WebDAV) information

(op=220)

Returns whether FlashAir Drive is enabled or not.

0 Disable FlashAir Drive
1 Enable FlashAir Drive(read only)
2 Enable FlashAir Drive. Needs also UPLOAD=1 to write files.

Request Example:

http://flashair/command.cgi?op=220

Response Example:

1

This operation is available in Firmware Versions 3.00.00+

Get timezone

(op=221)

Returns the timezone that will be used to convert from FAT file time to UTC time when FlashAir Drive is run. The timezone is stored in 15 minute increments, ranging from -48 to 54. For example UTC standard time is 0, and Japan time (which is 9 hours ahead), is 36 (9(h)×4(15m)=36).

Request Example:

http://flashair/command.cgi?op=221

Response Example:

36

This operation is available in Firmware Versions 3.00.00+